import React, { Component } from 'react';
import {
    ScrollView,
    StyleSheet,
    Text,
    View,
    Image,
    Modal,
    TouchableOpacity
} from 'react-native';

import ImageViewer from 'react-native-image-zoom-viewer';

export default class ApplicationList extends React.Component {
    // static navigationOptions = {
    //     title: '图片查看',
    // };
    constructor(props) {
        super(props);
        this.state = {
            images: [],
            index: 0
        }
    }
    UNSAFE_componentWillMount() {
        // var srcData = this.props.navigation.state.params.imageUrls;
        // var index = this.props.navigation.state.params.index;
        // // console.log(index + "图片数组=>", srcData)
        // // const images = eval(srcData);
        // const images = srcData.map(item => ({
        //     url: item
        // }));
        // this.setState({ images, index })
    }
    // 构造
    onClick() {
        this.props.navigation.goBack();
    }
    renderMenus(cancel, saveToLocal) {
        console.log("渲染菜单1", cancel)
        console.log("渲染菜单2", saveToLocal)
        return (
            <View>
                <Text style={{ height: 40 }}>{'渲染菜单1'}</Text>
            </View>
        )
    }
    render() {
        let { images, index } = this.state
        return (
            <ImageViewer
                imageUrls={images}
                onClick={() => this.onClick()}
                onDoubleClick={() => this.onClick()}
                index={index}
                // loadingRender={() => { return <Image source={require('../../assets/Public/loading3.gif')} /> }}
                // menus={({ cancel, saveToLocal }) => this.renderMenus(cancel, saveToLocal)}
                menuContext={{ saveToLocal: '保存到本地', cancel: '取消' }}
            />
        )
    }
}
